package com.example.admin.result;

public class ResponseResult<T> {

    private String code;

    private String message;

    private T data;

    private Integer total;

    private String traceID;

    public ResponseResult() {

    }

    public ResponseResult(String code, String message) {
        this();
        this.code = code;
        this.message = message;
    }

    public ResponseResult(String code, String message, T data) {
        this();
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public ResponseResult(String code, String message, T data, Integer total) {
        this();
        this.code = code;
        this.message = message;
        this.data = data;
        this.total = total;
    }

    public ResponseResult success(String code, String message) {
        return new ResponseResult(code, message);
    }

    public ResponseResult success(String code, String message, T data) {
        return new ResponseResult(code, message, data);
    }

    public ResponseResult success(String code, String message, T data, Integer total) {
        return new ResponseResult(code, message, data, total);
    }

    public static <T> ResponseResult<T> succeed(String code, String message) {
        return new ResponseResult<T>().success(code, message);
    }

    public static <T> ResponseResult<T> succeed(String code, String message, T data) {
        return new ResponseResult<T>().success(code, message, data);
    }

    public static <T> ResponseResult<T> succeed(String code, String message, T data, Integer total) {
        return new ResponseResult<T>().success(code, message, data, total);
    }

    public ResponseResult fail(String code, String message) {
        return new ResponseResult(code, message);
    }

    public ResponseResult fail(String code, String message, T data) {
        return new ResponseResult(code, message, data);
    }

    public ResponseResult fail(String code, String message, T data, Integer total) {
        return new ResponseResult(code, message, data, total);
    }

    public static <T> ResponseResult<T> failed(String code, String message) {
        return new ResponseResult<T>().fail(code, message);
    }

    public static <T> ResponseResult<T> failed(String code, String message, T data) {
        return new ResponseResult<T>().fail(code, message, data);
    }

    public static <T> ResponseResult<T> failed(String code, String message, T data, Integer total) {
        return new ResponseResult<T>().fail(code, message, data, total);
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public String getTraceID() {
        return this.traceID;
    }

    public void setTraceID(String traceID) {
        this.traceID = traceID;
    }

}
